﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TimeAxis.Admin
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            DavidDB.ADO.DBManager dbmanager = new DavidDB.ADO.DBManager();
            Models.Users user = Impls.ImplUsers.GetInstance(dbmanager).Login(this.UserName.Text, this.Password.Text);
            dbmanager.Commit();
            dbmanager.Dispose();
            if (user != null)
            {
                Common.Web.Cookie cookie = new Common.Web.Cookie();
                cookie.SetCookie("LoginUserId", user.Id.ToString(), 100);
                Response.Redirect("MyList.aspx");
            }
            else
            {
                this.Page.RegisterClientScriptBlock("login", "<script type=\"text/javascript\">alert('用户名或密码错误')</script>");
            }


        }
    }
}